var activeObject = null;
var enter = false;

function form_onkeypress(event, hasenter)
{
	var cancel;

	if (event.keyCode == 13)
	{
		if( hasenter)
		{
			document.forms[0]._EventName.value = 'EENTER.';

			if (navigator.appName != "Netscape")
			{
				activeObject = document.activeElement;
			}
			enter=true;
		}
		else
		{
			if (navigator.appName != "Netscape")
			// Netscape doesnt support any of this.
			{
				activeObject = document.activeElement;

				cancel = true;

				if(activeObject != null)
				{
					if( activeObject.nodeName == "A" || activeObject.nodeName == "TEXTAREA")
					{
						cancel = false;
					}
					else if( activeObject.nodeName == "INPUT")
					{
						if(	activeObject.attributes.item('type').value == "submit" ||
						    activeObject.attributes.item('type').value == "image")
						{
							cancel = false;
						}
					}
				}

				event.cancelBubble = cancel;
				event.returnValue = !cancel;
			}
			enter=false;
		}
	}
}

function GX_setevent( Name)
{
	var cancel;

	if( navigator.appName == "Netscape")
	{
		document.forms[0]._EventName.value = Name;
	}
	else
	{
		cancel = true;

		if (enter && activeObject != null)
		{
			if( activeObject.nodeName == "A" || activeObject.nodeName == "TEXTAREA")
			{
				cancel = false;
			}
			else if(activeObject.nodeName == "INPUT")
			{
				if ( activeObject.attributes.item('type').value == "submit" ||
					activeObject.attributes.item('type').value == "image")
				{
					cancel = false;
				}
			}
		}
		else
		{
			cancel = false;
		}

		if( !cancel)
		{
			document.forms[0]._EventName.value = Name;
		}
	}
}
